package main.components;

import javax.swing.*;
import java.awt.*;

public class GradientPanel extends JPanel {

    private Color color1, color2;

    public GradientPanel(LayoutManager layoutManager) {
        super(layoutManager);
        setOpaque(false);
        color1 = new Color(250, 102, 100);
        color2 = new Color(253, 7, 2);

    }

    public GradientPanel(LayoutManager layoutManager, Color color1, Color color2) {
        super(layoutManager);
        setOpaque(false);
        this.color1 = color1;
        this.color2 = color2;
    }

    public void paintComponent(Graphics g) {
        super.paintComponent(g);

        Graphics2D g2 = (Graphics2D) g;
        g2.setPaint(new GradientPaint(0,0, color1, 0, getHeight()/2, color2, false));
        g2.fillRect(0,0,getWidth(), getHeight());
        super.paintComponent( g );
    }


}

